# -*- coding: utf-8 -*-
# @Time    : 2024/2/28 11:49
# @Author  : Liaogan
# @FileName: classmethod和staticmethod.py

class MyClass:
    class_variable = 0

    @classmethod
    def increment_class_variable(cls, amount):
        cls.class_variable += amount

MyClass().increment_class_variable(5)
print(MyClass().class_variable)  # 输出 5

obj = MyClass()
obj.increment_class_variable(3)
print(MyClass.class_variable)  # 输出 8